package com.sasken.pdb.controllers.events
{
	import flash.events.Event;
	
	/**
	 * This event class is used to notify when user logs in or out.
	 */
	public class AccessEvent extends Event
	{
		private var _success:Boolean;
		private var _message:String;
		
		/**
		 * The event type used when user logs in.
		 */ 
		public static var LOGGED_IN_EVENT:String = "loggedInEvent";
		
		/**
		 *  The event type used when user logs out.
		 */ 
		public static var LOGGED_OUT_EVENT:String = "loggedOutEvent";
		
		/**
		 *  Constructor.
		 *  @param type The type of the event.
		 *  @param success True if login was successful.
		 *  @param message The message associated with the event.
		 */ 
		public function AccessEvent(type:String, success:Boolean=true,
			message:String="", bubbles:Boolean=false, cancelable:Boolean=false)
		{
			super(type, bubbles, cancelable);
			_success = success;
			_message = message;
		}
		
		/**
		 *  Returns if login was successful.
		 *  @return true on successful login. 
		 */ 
		public function get success():Boolean
		{
			return _success;
		}			

		/**
		 *  Returns the message associated with the login event.
		 *  @return Message assosiatied with the login event.
		 */ 
		public function get message():String
		{
			return _message;
		}			

	}
}